From 632192e7a9e8dc3f1c05a81dea2472880e97dce5 Mon Sep 17 00:00:00 2001 From: "cl349@firebug.cl.cam.ac.uk" Date: Wed, 31 Aug 2005 08:43:31 +0000 Subject: [PATCH] Use MIN instead of MAX to avoid reading more than fits into the buffer. Signed-off-by: Anthony Liguori Signed-off-by: Christian Limpach --- tools/console/daemon/io.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/console/daemon/io.c b/tools/console/daemon/io.c index e7c023bf30..885e291456 100644 --- a/tools/console/daemon/io.c +++ b/tools/console/daemon/io.c @@ -371,7 +371,7 @@ static void handle_tty_read(struct domain *dom) (struct ring_head *)(dom->page + PAGE_SIZE/2); int i; - len = read(dom->tty_fd, msg, MAX(XENCONS_SPACE(inring), sizeof(msg))); + len = read(dom->tty_fd, msg, MIN(XENCONS_SPACE(inring), sizeof(msg))); if (len < 1) { close(dom->tty_fd); dom->tty_fd = -1; -- 2.30.2